<template>
	<view class="">
		<view class="outer">
			<view class="outerbox" v-for="(item,index) in arr" :key="index">
				<view class="conttext">
					{{item.describe}}
				</view>
				<view class="time">
					{{item.create_time}}
				</view>
			</view>
		</view>



		<view class="bom">
			<textarea value="" placeholder="请输入带看记录描述" @input="shuru" />
			<view class="submit" @click="submit">
				提交
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getaddrecordlist
	} from "../../api/api/index.js"
	import {getaddrecord} from "../../api/api/index.js"
	export default {
		data() {
			return {
				arr:[],
				id:0,
				houseid:0,
				describe:""
			}
		},
		onLoad(e) {
			this.id=e.id
			this.houseid=e.houseid
			let data = {
				id:e.id,
				house_second_id: e.houseid,
				page: 1,
				limit: 10
			}
			getaddrecordlist(data).then(res => {
				this.arr=res.data
			})
		},
		methods:{
			// 接口函数
			hanshu(){
				let data = {
					id:this.id,
					house_second_id: this.houseid,
					page: 1,
					limit: 10
				}
				getaddrecordlist(data).then(res => {
					this.arr=res.data
				})
			},
			submit(){
				let data={id:this.id,house_second_id:this.houseid,describe:this.describe}
				getaddrecord(data).then(res=>{
					this.hanshu()
					uni.showToast({
						title:res.message,
						icon:"none",
						duration:1500
					})
					setTimeout(function(){
						uni.navigateBack({})
					},1500)
				})
			},
			shuru(e){
				this.describe=e.detail.value
			}
		}
	}
</script>

<style scoped lang="scss">
	.outer{
		height: 786rpx;
		overflow-y: auto;
	}
	.outerbox {
		margin: 20rpx;
		width: 709rpx;
		background-color: #FFFFFF;
		box-shadow: 3rpx 4rpx 7rpx 0rpx rgba(180, 180, 180, 0.46);
		border-radius: 10rpx;
		padding: 20rpx;
		box-sizing: border-box;
		.conttext{
			color: #000000;
			font-size: 30rpx;
			word-break:break-all;
		}
		.time{
			font-size: 20rpx;
			color: #CCCCCC;
			margin-top: 40rpx;
			margin-left: 80%;
		}
	}
	.bom{
		position: fixed;
		bottom: 0rpx;
		left: 20rpx;
		right: 20rpx;
		textarea{
			width: 100%;
			padding: 20rpx;
			box-sizing: border-box;
			border-top-left-radius: 10rpx;
			border-topright-radius: 10rpx;
			border: 1rpx solid #CCCCCC;
			background-color: #FFFFFF;
		}
		
	}
	.submit{
		width: 100%;
		height: 100rpx;
		background-color: #ef0000;
		line-height: 100rpx;
		text-align: center;
		color: #FFFFFF;
		border-bottom-left-radius: 10rpx;
		border-bottom-right-radius: 10rpx;
	}
</style>
